<text><span class="style4">escription</span><span class="style1">FileFlex generates error codes for many of its activities. Rather than just returning a code, the function </span><span class="style2">dbErrorString</span><span class="style1"> returns the full text of the error message. The command </span><span class="style2">dbCheckResult</span><span class="style1"> displays an answer dialog with the appropriate error message if its result parameter is an error.</span><span class="style4">Using dbErrorString</span><span class="style1">Format is: </span><span class="style3"> put dbErrorString(resultCode) into str</span><span class="style1">ResultCode is the code returned by the various FileFlex externals upon completion of execution.</span><span class="style4">Using dbCheckResult</span><span class="style1">Format is: </span><span class="style3">dbCheckResult resultCode</span><span class="style1"> Normally, FileFlex indicates successful completion by returning a 0 or positive number. If dbCheckResult is called with a number greater than or equal to zero, nothing happens. However, if dbCheckResult is called with a number less than zero, it returns an error message and drops out of the currently running script back to HyperCard.</span><span class="style4">Installing dbErrorString and dbCheckResult</span><span class="style1">Both routines are located in the stack script of this stack. You can copy them to your own stack, to the FileFlex‚Ñ¢ master stack, or (if HyperCard 2.0 or greater) execute a start using command to include this stack in the message heirarchy</span></text>
</content>
<name>full text error messages</name>
<script>on closeCardset scroll of cd field 1 to 1end closeCard</script>
</card>
card_4749.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
<text><span class="style4">escription</span><span class="style1">Automatic data entry validation XFCN that prevents user from entering invalid data into a FileFlex database field.</span><span class="style4">About SmartFields</span><span class="style1"></span><span class="style2">SmartFields</span><span class="style1"> is an XFCN that is called for every </span><span class="style2">keyDown</span><span class="style1"> event occuring in the data card. When a key is pressed, that keypress is sent to </span><span class="style2">SmartFields</span><span class="style1">, which determines if the keypress occured inside a card or background field corresponding to a field in the currently active FileFlex database. It then dynamically validates user input so that no invalid data is entered. For example, if the entry field is a character field of length 20, </span><span class="style2">SmartFields</span><span class="style1"> will prevent the user from typing in the 21st character and will beep.If the field is defined as numeric or date, </span><span class="style2">SmartFields</span><span class="style1"> will prevent any characters other than "0123456789." from being entered.If the field is logical, </span><span class="style2">SmartFields</span><span class="style1"> will only allow "tTfF" to be entered.</span><span class="style4">Installing SmartFields</span><span class="style1">Because </span><span class="style2">SmartFields</span><span class="style1"> lives in the </span><span class="style2">keyDown</span><span class="style1"> handler, it is only compatible with HyperCard 2.0 or greater. We've installed the XFCN into this stack and you'll either have to move it into your own stack or issue a </span><span class="style2">start using</span><span class="style1"> command.</span><span class="style4">Programming for SmartFields</span><span class="style2">SmartFields</span><span class="style1"> also relies on data from the current database structure, returned using the </span><span class="style2">dbListFields()</span><span class="style1"> call in FileFlex. Rather than getting the structure for every keypress, we recommend retrieving it when the user clicks in the field for the first time. Put this handler in your card script:</span><span class="style3">on openField global dbSMARTFIELDS put dbListFields() into dbSMARTFIELDS pass openFieldend openField</span><span class="style1">The </span><span class="style2">keyDown</span><span class="style1"> handler will rely on the global dbSMARTFIELDS as being active when it's ready to call the </span><span class="style2">SmartFields</span><span class="style1"> XFCN. Here's the </span><span class="style2">keyDown</span><span class="style1"> handler as it should be written with </span><span class="style2">SmartFields</span><span class="style1"> installed:</span><span class="style3">on keyDown x global dbSMARTFIELDS if smartFields(x,dbSMARTFIELDS,the target) is true then pass keyDown end ifend keyDown</span><span class="style1">Notice that the keyDown message is only passed if SmartFields decided that the data was a valid entry for the field.</span></text>
</content>
<name>smart fields</name>
<script>on closeCardset scroll of cd field 1 to 1end closeCard</script>
</card>
card_6372.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
<text><span class="style4">escription</span><span class="style2"></span><span class="style1">Easily view database .DBF files using a pop-up palette. Just select a .DBF file and you'll see its structure.</span><span class="style4">About the View Database Structure Palette</span><span class="style1">To create a database quickly and easily, press the View Database Structure button below. Up will pop the View Database palette (created using our very own SuperPalette product). Click View DB to select a database. Does not allow for structure editing.</span><span class="style2">Warning: </span><span class="style1">This feature requires HyperCard 2.0 or greater and uses the HyperCard 2.X XCMD interface.</span></text>
</content>
<name>view database</name>
<script>on closeCardif there is a window "dbSchema" thenclose window "dbSchema"end ifpass closeCardend closeCardon viewDBset cursor to 4answer file "Select database to view:" of type "F+DB"if it is empty then exit viewDBset cursor to 4put dbUse(it) into dbResultdbcheckResult dbResultset the fieldList of window "dbSchema" to dbListFields()set the filespec of window "dbSchema" to itput dbCloseAll() into dbResultend viewDBon suspendStackif there is a window "dbSchema" thenhide window "dbSchema"end ifpass suspendStackend suspendStackon resumeStackif there is a window "dbSchema" thenshow window "dbSchema"end ifpass resumeStackend resumeStack</script>
</card>
card_4240.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >
<script>on mouseUpsuperPalette "dbCreate"set the fieldLength of window "dbCreate" to "8"set the fieldDecimals of window "dbCreate" to "2"end mouseUp</script>
</part>
<content>
<layer>card</layer>
<id>1</id>
<text><span class="style4">escription</span><span class="style2"></span><span class="style1">Easily create new database .DBF files using a pop-up palette. Just fill in the form and a new database file will be generated.</span><span class="style4">About the Create Database Palette</span><span class="style1">To create a database quickly and easily, press the Create Database button below. Up will pop the Create Database palette (created using our very own SuperPalette product). </span><span class="style2">Warning: </span><span class="style1">This feature requires HyperCard 2.0 or greater and uses the HyperCard 2.X XCMD interface.</span></text>
</content>
<name>create Database</name>
<script>on closeCardif there is a window "dbCreate" thenif theFields of window "dbCreate" is not empty thenanswer "Create database?" with "No" or "Create DB"if it is "Create DB" then createDBend ifclose window "dbCreate"end ifpass closeCardend closeCardon suspendStackif there is a window "dbCreate" thenhide window "dbCreate"end ifpass suspendStackend suspendStackon resumeStackif there is a window "dbCreate" thenshow window "dbCreate"end ifpass resumeStackend resumeStackon nameFieldask "Please enter a new field name:" with ¬the fieldName of window "dbCreate"if it is empty then exit nameFieldset cursor to 4repeat with i = 1 to the number of chars of itif char i of it is not in "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" thenanswer "Invalid field name. FileFlex fields may only have" &&¬"the characters A-Z and 0-9."exit nameFieldend ifend repeatput theFields of window "dbCreate" into theFieldsrepeat with i = 1 to the number of lines of theFieldsif it = item 1 of line i of theFields thenanswer "Duplicate field name."exit nameFieldend ifend repeatset the fieldName of window "dbCreate" to itend nameFieldon setFieldLengthput the fieldType of window "dbCreate" into fieldTypeif fieldType is "Character" or fieldType is "Numeric" thenask "Please enter the field length (max 254):" with ¬the fieldLength of window "dbCreate"if it is empty then exit setFieldLengthset cursor to 4if it > 254 thenanswer "Maximum field length is 254."put 254 into itend ifset the fieldLength of window "dbCreate" to itelseanswer "There is no need to set the field length of a" &&¬fieldType && "field."end ifend setFieldLengthon setFieldDecimalsput the fieldType of window "dbCreate" into fieldTypeif fieldType is "Numeric" thenask "Please enter the precision (max 16):" with ¬the fieldDecimals of window "dbCreate"if it is empty then exit setFieldDecimalsset cursor to 4if it > 16 thenanswer "Maximum field length is 16."put 16 into itend ifset the fieldDecimals of window "dbCreate" to itelseanswer "There is no need to set the precision of a" &&¬fieldType && "field."end ifend setFieldDecimalson fieldType optionset cursor to 4if option is "Memo" or option is "Logical" or option is "Date" thenset the fieldLength of window "dbCreate" to "N/A"set the fieldDecimals of window "dbCreate" to "N/A"end ifif option is "Character" thenset the fieldDecimals of window "dbCreate" to "N/A"if the fieldLength of window "dbCreate" is "N/A" or¬the fieldLength of window "dbCreate" is empty thenset the fieldLength of window "dbCreate" to "10"end ifend ifif option is "Numeric" thenif the fieldLength of window "dbCreate" is "N/A" or¬the fieldLength of window "dbCreate" is empty thenset the fieldLength of window "dbCreate" to "8"end ifif the fieldDecimals of window "dbCreate" is "N/A" or¬the fieldDecimals of window "dbCreate" is empty thenset the fieldDecimals of window "dbCreate" to "2"end ifend ifend fieldTypeon addFieldset the lockScreen of window "dbCreate" to trueif the fieldName of window "dbCreate" is empty thenanswer "You must choose a field name."exit addFieldend ifput the fieldName of window "dbCreate" into schemaLineput the fieldType of window "dbCreate" into typespecput schemaLine & "," & char 1 of typeSpec into schemaLineif typespec is "Character" thenput schemaLine & "," & the fieldLength of window "dbCreate" into schemaLineend ifif typespec is "Numeric" thenput schemaLine & "," & the fieldLength of window "dbCreate" into schemaLineput schemaLine & "," & the fieldDecimals of window "dbCreate" into schemaLineend ifif theFields of window "dbCreate" is empty thenset theFields of window "dbCreate" to schemaLineelseset theFields of window "dbCreate" to ¬(theFields of window "dbCreate" & return & schemaLine)end ifset the fieldName of window "dbCreate" to emptyset the fieldType of window "dbCreate" to "Numeric"set the fieldLength of window "dbCreate" to 8set the fieldDecimals of window "dbCreate" to 2set the lockScreen of window "dbCreate" to falseend addFieldon theFields m,nset cursor to 4get theFields of window "dbCreate"put line n of it into schemaLineif line n of it is empty thenset the fieldName of window "dbCreate" to emptyset the fieldType of window "dbCreate" to "Numeric"set the fieldLength of window "dbCreate" to 8set the fieldDecimals of window "dbCreate" to 2exit theFieldsend ifset the fieldName of window "dbCreate" to item 1 of schemaLineput item 2 of schemaLine into typeSpecif typeSpec is "C" thenset the fieldType of window "dbCreate" to "Character"put item 3 of typeSpec into fooset the fieldLength of window "dbCreate" to item 3 of schemaLineset the fieldDecimals of window "dbCreate" to "N/A"else if typeSpec is "N" thenput item 3 of typeSpec into fooput item 4 of typeSpec into barset the fieldType of window "dbCreate" to "Numeric"set the fieldLength of window "dbCreate" to item 3 of schemaLineset the fieldDecimals of window "dbCreate" to item 4 of schemaLineelse if typeSpec is "L" thenset the fieldType of window "dbCreate" to "Logical"set the fieldLength of window "dbCreate" to "N/A"set the fieldDecimals of window "dbCreate" to "N/A"else if typeSpec is "M" thenset the fieldType of window "dbCreate" to "Memo"set the fieldLength of window "dbCreate" to "N/A"set the fieldDecimals of window "dbCreate" to "N/A"else if typeSpec is "D" thenset the fieldType of window "dbCreate" to "Date"set the fieldLength of window "dbCreate" to "N/A"set the fieldDecimals of window "dbCreate" to "N/A"end ifend theFieldson deleteFieldget the fields of window "dbCreate"get line 1 of it -- info for list fieldput item 7 of it into selectedLineif selectedLine is 0 thenanswer "Nothing to delete."exit deleteFieldend ifput theFields of window "dbCreate" into fieldListdelete line selectedLine of fieldListset theFields of window "dbCreate" to fieldListset the fieldName of window "dbCreate" to emptyset the fieldType of window "dbCreate" to "Numeric"set the fieldLength of window "dbCreate" to 8set the fieldDecimals of window "dbCreate" to 2end deleteFieldon createDBset cursor to 4put theFields of window "dbCreate" into fieldListif fieldList is empty thenanswer "Please define some fields first."exit createDBend if-- clear any accidentally created empty linesput fieldList into testListput empty into fieldListrepeat with i = 1 to the number of lines of testListif line i of testList is not empty thenif fieldList is empty thenput line i of testList into fieldListelseput return & line i of testList after fieldListend ifend ifend repeatask file "Name of new database:"if it is empty then exit createDBput it into fileSpecput the number of chars of fileSpec into cntput char cnt-3 to cnt of fileSpec into testDBFif testDBF=".DBF" or testDBF=".DBT" thendelete char cnt-3 to cnt of fileSpecend ifput the number of lines of fieldList into numFieldsput there is a file (fileSpec & ".DBF") into fooif there is a file (fileSpec & ".DBF") thenanswer "A database by that name already exists."exit createDBend ifput dbCreate(fileSpec,numFields,fieldList,"true") into dbResultif dbResult < 0 thendbCheckResult dbResultelseanswer "Database successfully created."end ifput dbCloseAll() into dbResultend createDb</script>
</card>
card_2981.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE card PUBLIC "-//Apple, Inc.//DTD card V 2.0//EN" "" >